package com.baizhi.rjb.Controller;

import com.baizhi.rjb.entity.User;
import com.baizhi.rjb.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("user")
@CrossOrigin
public class UserController {
    @Autowired
    private UserService  userService;

    @RequestMapping("queryAllPage")
    @ResponseBody
    public Map<String,Object> queryAllPage(int page,int pageSize){
        return userService.queryAllPage(page,pageSize);
    }

    @RequestMapping("update")
    @ResponseBody
    public Map<String,Object> update(@RequestBody User user){
        return userService.updata(user);
    }
}
